package top.huxy.boot.config.interceptor;

import org.springframework.web.servlet.HandlerInterceptor;
import top.huxy.boot.util.obj.ThreadLocalAdmin;
import top.huxy.boot.util.obj.ThreadLocalUser;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Classname ThreadLocalTerminateInterceptor
 * @Description 释放ThreadLocal中的变量
 * @Date 2021/9/24 21:17
 * @Created by huxy
 */
public class ThreadLocalTerminateInterceptor implements HandlerInterceptor {
    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
        ThreadLocalUser.destroy();
        ThreadLocalAdmin.destroy();
    }
}
